import { GET_COMMON_CONFIGS } from '@/configs/api';
import { IConfigs, IOption } from '@/typings';
import { axiosPost } from '@/utils/http';

export const httpGetCommonConfigs = async () => {
  const { data } = await axiosPost(GET_COMMON_CONFIGS);
  const configs: IConfigs | {} = {};
  for (const key in data) {
    const options: IOption[] = [];
    data[key].forEach((p: string) => {
      options.push({ label: p, value: p });
    });
    configs[key] = options;
  }
  return configs;
};
